package com.xframe.domain.sys;


import com.xframe.xdal.core.annotation.AutoFill;
import com.xframe.xdal.core.annotation.XColumn;
import com.xframe.xdal.core.annotation.XSelectItem;
import com.xframe.xdal.core.annotation.XTable;
import com.xframe.xdal.core.autofill.specification.ICacheKeyGenerate;
import com.xframe.xdal.core.constant.AutoFillType;
import lombok.Data;

/**
 * 实体视图
 *
 * @author xufeng
 * @version 1.0
 * @date 2023-06-28
 */
@Data
@XTable(value = "SYS_MODEL_VIEW", label = "实体视图")
@XSelectItem(keyName = "modelViewId",codeName = "modelViewId",textName = "queryKey")
public class SysModelViewConfig extends SysModelConfig implements ICacheKeyGenerate {

    /**
     * 实体视图ID
     */
    /*@AutoFill(AutoFillType.Snowflake)
    @XColumn(name = "MODEL_VIEW_ID", primaryKeyFlag = true,desc = "实体视图ID")
    private Long modelViewId;*/

    /**
     * 渲染引擎
     */
    @XColumn(name = "RENDER_CLASS",desc = "渲染引擎",length = 500)
    protected String renderClass;


    /**
     * 参数列表
     */
    @XColumn(name = "PARAMETER_STRING",desc = "参数列表",length = 1000)
    protected String parameter;

    /**
     * 视图描述
     */
    @XColumn(name = "VIEW_NAME",desc = "视图描述",length = 50)
    protected String viewName;




//
//
//    public void createNewView(IUserCredentials userCredentials) throws Exception {
//        createNewView(DataBaseAccess.getInstance(),userCredentials);
//    }
//    public void createNewView(DataBaseAccess dataBaseAccess,IUserCredentials userCredentials) throws Exception {
//        IDbTransaction tran = null;
//        try{
//            tran = dataBaseAccess.beginTransaction();
//            dataBaseAccess.createNew(this,tran);
//            tran.commit();
//        }catch (Exception exception){
//            tran.rollBack();
//            throw exception;
//        }finally {
//            if(tran != null){
//                dataBaseAccess.closeTransaction(tran);
//            }
//        }
//    }


    @Override
    public String getCacheKey() {
        return this.configType + this.modelCode;
    }
}
